<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <lk-box></lk-box>
      
    </div>

    <script src="../js/vue.js"></script>

    <script>
      const app = Vue.createApp({
        data() {
          return {
            msg: ""
          }
        }
      });

      //注册全局组件
      app.component('btn-component',{
        data(){
          return {
            count : 0,
          }
        },
        template:`
        <button @click="count++">共点击了{{count}}次</button>
        `,
      });

      app.component('lk-box',{
        template:`
          <div style="width: 200px; height: 200px; background-color: bisque;">
            盒子组件
            <btn-component></btn-component>
            <btn-component></btn-component>
          </div>
        `,
      });
      //挂载实例
      app.mount("#app");
    </script>
  </body>
</html>